package com.example.tests;

public class ContactInfo implements Comparable<ContactInfo>{
	private String firstName;
	private String lastName;
	private String address;
	private String homeNumber;
	private String mobileNumber;
	private String workNumber;
	private String email;
	private String email2;
	private String bday;
	private String bmonth;
	private String byear;
	private String contactGroup;
	private String secAddress;
	private String secNumber;
	private String id;

	public ContactInfo() {
		
	}
	
	public ContactInfo(String firstName, String lastName, String address, String homeNumber, String mobileNumber, 
			String workNumber, String email, String email2, String bday, String bmonth, String byear, String contactGroup,
			String secAddress, String secNumber) {
		this.firstName = firstName;
		this.lastName = lastName;
		this.address = address;
		this.homeNumber = homeNumber;
		this.mobileNumber = mobileNumber;
		this.workNumber = workNumber;
		this.email = email;
		this.email2 = email2;
		this.bday = bday;
		this.bmonth = bmonth;
		this.byear = byear;
		this.contactGroup = contactGroup;
		this.secAddress = secAddress;
		this.secNumber = secNumber;
	}

	

	@Override
	public String toString() {
		return "ContactInfo [firstName=" + firstName + ", lastName=" + lastName
				+ ", homeNumber=" + homeNumber + ", email=" + email + "]";
	}

	@Override
	public int compareTo(ContactInfo other) {
		return this.toString().toLowerCase().compareTo(other.toString().toLowerCase());
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		//result = prime * result + ((email == null) ? 0 : email.hashCode());
		//result = prime * result
				//+ ((firstName == null) ? 0 : firstName.hashCode());
		//result = prime * result
		//		+ ((homeNumber == null) ? 0 : homeNumber.hashCode());
		//result = prime * result
		//		+ ((lastName == null) ? 0 : lastName.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		ContactInfo other = (ContactInfo) obj;
		
		if (email == null) {
			if (other.email != null)
				return false;
		} else if (!email.equals(other.email))
			return false;
		
		if (firstName == null) {
			if (other.firstName != null)
				return false;
		} else if (!firstName.equals(other.firstName))
			return false;
		
		if (homeNumber == null) {
			if (other.homeNumber != null)
				return false;
		} else if (!homeNumber.equals(other.homeNumber))
			return false;
		
		if (lastName == null) {
			if (other.lastName != null)
				return false;
		} else if (!lastName.equals(other.lastName))
			return false;
		
		return true;
	}

	public ContactInfo withFirstName(String firstName) {
		this.firstName = firstName;
		return this;
	}

	public ContactInfo withLastName(String lastName) {
		this.lastName = lastName;
		return this;
	}
	
	public ContactInfo withAddress(String address) {
		this.address = address;
		return this;
	}

	public ContactInfo withEmail(String email) {
		this.email = email;
		return this;
	}

	public ContactInfo withHomeNumber(String homeNumber) {
		this.homeNumber = homeNumber;
		return this;
	}

	public ContactInfo withMobileNumber(String mobileNumber) {
		this.mobileNumber = mobileNumber;
		return this;
	}

	public ContactInfo withWorkNumber(String workNumber) {
		this.workNumber = workNumber;
		return this;
	}

	public ContactInfo withEmail2(String email2) {
		this.email2 = email2;
		return this;
	}
	
	public ContactInfo withId(String id) {
		this.id = id;
		return this;
	}

	public String getId() {
		return id;
	}

	public String getFirstName() {
		return firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public String getAddress() {
		return address;
	}

	public String getHomeNumber() {
		return homeNumber;
	}

	public String getMobileNumber() {
		return mobileNumber;
	}

	public String getWorkNumber() {
		return workNumber;
	}

	public String getEmail() {
		return email;
	}

	public String getEmail2() {
		return email2;
	}

	public String getBday() {
		return bday;
	}

	public String getBmonth() {
		return bmonth;
	}

	public String getByear() {
		return byear;
	}

	public String getContactGroup() {
		return contactGroup;
	}

	public String getSecAddress() {
		return secAddress;
	}

	public String getSecNumber() {
		return secNumber;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public void setHomeNumber(String homeNumber) {
		this.homeNumber = homeNumber;
	}

	public void setMobileNumber(String mobileNumber) {
		this.mobileNumber = mobileNumber;
	}

	public void setWorkNumber(String workNumber) {
		this.workNumber = workNumber;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public void setEmail2(String email2) {
		this.email2 = email2;
	}

	public void setBday(String bday) {
		this.bday = bday;
	}

	public void setBmonth(String bmonth) {
		this.bmonth = bmonth;
	}

	public void setByear(String byear) {
		this.byear = byear;
	}

	public void setContactGroup(String contactGroup) {
		this.contactGroup = contactGroup;
	}

	public void setSecAddress(String secAddress) {
		this.secAddress = secAddress;
	}

	public void setSecNumber(String secNumber) {
		this.secNumber = secNumber;
	}

	public void setId(String id) {
		this.id = id;
	}
	
	
}